package com.dick.base.util;

import org.apache.commons.lang3.RandomUtils;

public class CharUtil {

    private static final char[][] CHARS_ARRAY = new char[][]{
            new char[]{'\u0020','\u007F'},
            new char[]{'\u00A0','\u00FF'},
            new char[]{'\u0100','\u017F'},
            new char[]{'\u0180','\u023F'},
            new char[]{'\u0250','\u02AF'},
            new char[]{'\u02B0','\u02EF'},
            new char[]{'\u0300','\u036F'},
            new char[]{'\u0370','\u03FF'},
            new char[]{'\u0400','\u04FF'},
            new char[]{'\u0500','\u052F'},
            new char[]{'\u0530','\u058F'},
            new char[]{'\u0590','\u05FF'},
            new char[]{'\u0600','\u06FF'},
            new char[]{'\u0700','\u074F'},
            new char[]{'\u0750','\u077F'},
            new char[]{'\u0780','\u07BF'},
            new char[]{'\u07C0','\u07FF'},
            new char[]{'\u0900','\u097F'},
            new char[]{'\u0980','\u09FF'},
            new char[]{'\u0A00','\u0A7F'},
            new char[]{'\u0A80','\u0AFF'},
            new char[]{'\u0B00','\u0B7F'},
            new char[]{'\u0B80','\u0BFF'},
            new char[]{'\u0C00','\u0C7F'},
            new char[]{'\u0C80','\u0CFF'},
            new char[]{'\u0D00','\u0D7F'},
            new char[]{'\u0D80','\u0DFF'},
            new char[]{'\u0E00','\u0E7F'},
            new char[]{'\u0E80','\u0EFF'},
            new char[]{'\u0F00','\u0FFF'},
            new char[]{'\u1000','\u109F'},
            new char[]{'\u10A0','\u10FF'},
            new char[]{'\u1100','\u11FF'},
            new char[]{'\u1200','\u137F'},
            new char[]{'\u1380','\u139F'},
            new char[]{'\u13A0','\u13FF'},
            new char[]{'\u1400','\u167F'},
            new char[]{'\u1680','\u169F'},
            new char[]{'\u16A0','\u16FF'},
            new char[]{'\u1700','\u171F'},
            new char[]{'\u1720','\u173F'},
            new char[]{'\u1740','\u175F'},
            new char[]{'\u1760','\u177F'},
            new char[]{'\u1780','\u17FF'},
            new char[]{'\u1800','\u18AF'},
            new char[]{'\u1900','\u194F'},
            new char[]{'\u1950','\u197F'},
            new char[]{'\u1980','\u19DF'},
            new char[]{'\u19E0','\u19FF'},
            new char[]{'\u1A00','\u1A1F'},
            new char[]{'\u1B00','\u1B7F'},
            new char[]{'\u1D00','\u1D7F'},
            new char[]{'\u1D80','\u1DBF'},
            new char[]{'\u1DC0','\u1DFF'},
            new char[]{'\u1E00','\u1EFF'},
            new char[]{'\u1F00','\u1FFF'},
            new char[]{'\u2000','\u206F'},
            new char[]{'\u2070','\u209F'},
            new char[]{'\u20A0','\u20CF'},
            new char[]{'\u20D0','\u20FF'},
            new char[]{'\u2100','\u214F'},
            new char[]{'\u2150','\u218F'},
            new char[]{'\u2190','\u21FF'},
            new char[]{'\u2200','\u22FF'},
            new char[]{'\u2300','\u23FF'},
            new char[]{'\u2400','\u243F'},
            new char[]{'\u2440','\u245F'},
            new char[]{'\u2460','\u24FF'},
            new char[]{'\u2500','\u257F'},
            new char[]{'\u2580','\u259F'},
            new char[]{'\u25A0','\u25FF'},
            new char[]{'\u2600','\u26FF'},
            new char[]{'\u2700','\u27BF'},
            new char[]{'\u27C0','\u27EF'},
            new char[]{'\u27F0','\u27FF'},
            new char[]{'\u2800','\u28FF'},
            new char[]{'\u2900','\u297F'},
            new char[]{'\u2980','\u29FF'},
            new char[]{'\u2A00','\u2AFF'},
            new char[]{'\u2B00','\u2BFF'},
            new char[]{'\u2C00','\u2C5F'},
            new char[]{'\u2C60','\u2C7F'},
            new char[]{'\u2C80','\u2CFF'},
            new char[]{'\u2D00','\u2D2F'},
            new char[]{'\u2D30','\u2D7F'},
            new char[]{'\u2D80','\u2DDF'},
            new char[]{'\u2E00','\u2E7F'},
            new char[]{'\u2E80','\u2EFF'},
            new char[]{'\u2F00','\u2FDF'},
            new char[]{'\u2FF0','\u2FFF'},
            new char[]{'\u3000','\u303F'},
            new char[]{'\u3040','\u309F'},
            new char[]{'\u30A0','\u30FF'},
            new char[]{'\u3100','\u312F'},
            new char[]{'\u3130','\u318F'},
            new char[]{'\u3190','\u319F'},
            new char[]{'\u31A0','\u31BF'},
            new char[]{'\u31C0','\u31EF'},
            new char[]{'\u31F0','\u31FF'},
            new char[]{'\u3200','\u32FF'},
            new char[]{'\u3300','\u33FF'},
            new char[]{'\u3400','\u4DBF'},
            new char[]{'\u4DC0','\u4DFF'},
            new char[]{'\u4E00','\u9FFF'},
            new char[]{'\uA000','\uA48F'},
            new char[]{'\uA490','\uA4CF'},
            new char[]{'\uA700','\uA71F'},
            new char[]{'\uA720','\uA7FF'},
            new char[]{'\uA800','\uA82F'},
            new char[]{'\uA840','\uA87F'},
            new char[]{'\uAC00','\uD7AF'},
            new char[]{'\uD800','\uDB7F'},
            new char[]{'\uDB80','\uDBFF'},
            new char[]{'\uDC00','\uDFFF'},
            new char[]{'\uE000','\uF8FF'},
            new char[]{'\uF900','\uFAFF'},
            new char[]{'\uFB00','\uFB4F'},
            new char[]{'\uFB50','\uFDFF'},
            new char[]{'\uFE00','\uFE0F'},
            new char[]{'\uFE10','\uFE1F'},
            new char[]{'\uFE20','\uFE2F'},
            new char[]{'\uFE30','\uFE4F'},
            new char[]{'\uFE50','\uFE6F'},
            new char[]{'\uFE70','\uFEFF'},
            new char[]{'\uFF00','\uFFEF'}
    };

    public static char randomChar() {
        int x = RandomUtils.nextInt(0, CHARS_ARRAY.length);
        int y = RandomUtils.nextInt(0, CHARS_ARRAY[x].length);
        return CHARS_ARRAY[x][y];
    }
}
